﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<UserControl x:Class="System.Windows.Controls.Samples.NumericUpDownSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    
    >
    <UserControl.Resources>
        <ControlTemplate x:Key="IncreaseButtonTemplate" TargetType="RepeatButton">
            <Grid x:Name="Root">
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualStateGroup.Transitions>
                            <vsm:VisualTransition GeneratedDuration="0"/>
                            <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/>
                            <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Normal"/>
                        <vsm:VisualState x:Name="MouseOver">
                            <Storyboard>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF448DCA"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#F2FFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#CCFFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#7FFFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Pressed">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Highlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF448DCA"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#F4FFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#EAFFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#C6FFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#6BFFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                    <vsm:VisualStateGroup x:Name="FocusStates">
                        <vsm:VisualState x:Name="Focused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Unfocused"/>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <Rectangle x:Name="Background" RadiusX="2" RadiusY="2" Fill="{TemplateBinding Background}" StrokeThickness="1">
                    <Rectangle.Stroke>
                        <LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0">
                            <GradientStop Color="#FFAEB7BF" Offset="0"/>
                            <GradientStop Color="#FF919EA7" Offset="0.35"/>
                            <GradientStop Color="#FF7A8A99" Offset="0.35"/>
                            <GradientStop Color="#FF647480" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Stroke>
                </Rectangle>
                <Rectangle Margin="1" x:Name="BackgroundGradient" RadiusX="1" RadiusY="1" Stroke="#FFFFFFFF" StrokeThickness="1">
                    <Rectangle.Fill>
                        <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                            <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
                            <GradientStop Color="#E5FFFFFF" Offset="0.625"/>
                            <GradientStop Color="#C6FFFFFF" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <Rectangle Margin="1" x:Name="Highlight" IsHitTestVisible="false" Opacity="0" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA" StrokeThickness="1"/>
                <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA" StrokeThickness="1"/>
                <Path HorizontalAlignment="Stretch" Margin="4,3,4,3" VerticalAlignment="Stretch" Fill="#FF333333" Stretch="Uniform" Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z "/>
            </Grid>
        </ControlTemplate>
        <ControlTemplate x:Key="DecreaseButtonTemplate" TargetType="RepeatButton">
            <Grid x:Name="Root">
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualStateGroup.Transitions>
                            <vsm:VisualTransition GeneratedDuration="0"/>
                            <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/>
                            <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Normal"/>
                        <vsm:VisualState x:Name="MouseOver">
                            <Storyboard>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF448DCA"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#F2FFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#CCFFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#7FFFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Pressed">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Highlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF448DCA"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#F4FFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#EAFFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#C6FFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#6BFFFFFF"/>
                                </ColorAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                    <vsm:VisualStateGroup x:Name="FocusStates">
                        <vsm:VisualState x:Name="Focused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Unfocused"/>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <Rectangle x:Name="Background" RadiusX="2" RadiusY="2" Fill="{TemplateBinding Background}" StrokeThickness="1">
                    <Rectangle.Stroke>
                        <LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0">
                            <GradientStop Color="#FFAEB7BF" Offset="0"/>
                            <GradientStop Color="#FF919EA7" Offset="0.35"/>
                            <GradientStop Color="#FF7A8A99" Offset="0.35"/>
                            <GradientStop Color="#FF647480" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Stroke>
                </Rectangle>
                <Rectangle Margin="1" x:Name="BackgroundGradient" RadiusX="1" RadiusY="1" Stroke="#FFFFFFFF" StrokeThickness="1">
                    <Rectangle.Fill>
                        <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                            <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
                            <GradientStop Color="#E5FFFFFF" Offset="0.625"/>
                            <GradientStop Color="#C6FFFFFF" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <Rectangle Margin="1" x:Name="Highlight" IsHitTestVisible="false" Opacity="0" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA" StrokeThickness="1"/>
                <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA" StrokeThickness="1"/>
                <Path Height="Auto" HorizontalAlignment="Stretch" Margin="4,3,4,3" VerticalAlignment="Stretch" Width="Auto" Fill="#FF333333" Stretch="Uniform" Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z "/>
            </Grid>
        </ControlTemplate>

        <LinearGradientBrush x:Key="NUDBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FFA3AEB9" Offset="0"/>
            <GradientStop Color="#FF8399A9" Offset="0.375"/>
            <GradientStop Color="#FF718597" Offset="0.375"/>
            <GradientStop Color="#FF617584" Offset="1"/>
        </LinearGradientBrush>

        <ControlTemplate x:Key="ButtonSpinnerHorizontalTemplate" TargetType="inputToolkit:ButtonSpinner">
            <Grid>
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualStateGroup.Transitions>
                            <vsm:VisualTransition GeneratedDuration="0"/>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Normal"/>
                        <vsm:VisualState x:Name="Disabled">
                            <Storyboard>
                                <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                    <vsm:VisualStateGroup x:Name="FocusStates">
                        <vsm:VisualState x:Name="Focused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Unfocused"/>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="15"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="15"/>
                    </Grid.ColumnDefinitions>
                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" Grid.Column="1"/>
                    <RepeatButton IsTabStop="False" Template="{StaticResource IncreaseButtonTemplate}" x:Name="IncreaseButton" ClickMode="Press"/>
                    <RepeatButton IsTabStop="False" Template="{StaticResource DecreaseButtonTemplate}" x:Name="DecreaseButton" ClickMode="Press" Grid.Column="2"/>
                </Grid>
                <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/>
                <Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderBrush="#FF45D6FA" BorderThickness="1" CornerRadius="1,1,1,1"/>
            </Grid>
        </ControlTemplate>
        <Style x:Key="ButtonSpinnerHorizontalStyle" TargetType="inputToolkit:NumericUpDown">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="{StaticResource NUDBorderBrush}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="inputToolkit:NumericUpDown">
                        <Grid>
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualTransition GeneratedDuration="0"/>
                                    </vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualState x:Name="Normal"/>
                                    <vsm:VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="FocusStates">
                                    <vsm:VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Unfocused"/>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                <inputToolkit:ButtonSpinner x:Name="Spinner" MinWidth="35" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Template="{StaticResource ButtonSpinnerHorizontalTemplate}">
                                    <TextBox BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="20" x:Name="Text" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Right" TextWrapping="NoWrap"/>
                                </inputToolkit:ButtonSpinner>
                            </Border>
                            <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/>
                            <Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <ControlTemplate x:Key="ButtonSpinnerVerticalTemplate" TargetType="inputToolkit:ButtonSpinner">
            <Grid>
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualStateGroup.Transitions>
                            <vsm:VisualTransition GeneratedDuration="0"/>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Normal"/>
                        <vsm:VisualState x:Name="Disabled">
                            <Storyboard>
                                <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                    <vsm:VisualStateGroup x:Name="FocusStates">
                        <vsm:VisualState x:Name="Focused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Unfocused"/>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="10"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="10"/>
                    </Grid.RowDefinitions>
                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" Grid.Row="1"/>
                    <RepeatButton IsTabStop="False" Template="{StaticResource IncreaseButtonTemplate}" x:Name="IncreaseButton" ClickMode="Press"/>
                    <RepeatButton IsTabStop="False" Template="{StaticResource DecreaseButtonTemplate}" x:Name="DecreaseButton" ClickMode="Press" Grid.Row="2"/>
                </Grid>
                <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/>
                <Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderBrush="#FF45D6FA" BorderThickness="1" CornerRadius="1,1,1,1"/>
            </Grid>
        </ControlTemplate>
        <Style x:Key="ButtonSpinnerVerticalStyle" TargetType="inputToolkit:NumericUpDown">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="{StaticResource NUDBorderBrush}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="inputToolkit:NumericUpDown">
                        <Grid>
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualTransition GeneratedDuration="0"/>
                                    </vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualState x:Name="Normal"/>
                                    <vsm:VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="FocusStates">
                                    <vsm:VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Unfocused"/>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                <inputToolkit:ButtonSpinner x:Name="Spinner" MinWidth="35" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Template="{StaticResource ButtonSpinnerVerticalTemplate}">
                                    <TextBox BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="20" x:Name="Text" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Right" TextWrapping="NoWrap"/>
                                </inputToolkit:ButtonSpinner>
                            </Border>
                            <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/>
                            <Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <ControlTemplate x:Key="ButtonSpinnerLeftyTemplate" TargetType="inputToolkit:ButtonSpinner">
            <Grid>
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualStateGroup.Transitions>
                            <vsm:VisualTransition GeneratedDuration="0"/>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Normal"/>
                        <vsm:VisualState x:Name="Disabled">
                            <Storyboard>
                                <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                    <vsm:VisualStateGroup x:Name="FocusStates">
                        <vsm:VisualState x:Name="Focused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Unfocused"/>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="15"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" Grid.Column="1" Grid.RowSpan="2"/>
                    <RepeatButton x:Name="IncreaseButton" IsTabStop="False" Template="{StaticResource IncreaseButtonTemplate}" Grid.Column="0" Grid.Row="0" ClickMode="Press"/>
                    <RepeatButton x:Name="DecreaseButton" IsTabStop="False" Template="{StaticResource DecreaseButtonTemplate}" Grid.Column="0" Grid.Row="1" ClickMode="Press"/>
                </Grid>
                <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/>
                <Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderBrush="#FF45D6FA" BorderThickness="1" CornerRadius="1,1,1,1"/>
            </Grid>
        </ControlTemplate>
        <Style x:Key="ButtonSpinnerLeftyStyle" TargetType="inputToolkit:NumericUpDown">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="{StaticResource NUDBorderBrush}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="inputToolkit:NumericUpDown">
                        <Grid>
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualTransition GeneratedDuration="0"/>
                                    </vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualState x:Name="Normal"/>
                                    <vsm:VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="FocusStates">
                                    <vsm:VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Unfocused"/>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                <inputToolkit:ButtonSpinner x:Name="Spinner" MinWidth="35" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Template="{StaticResource ButtonSpinnerLeftyTemplate}">
                                    <TextBox BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="20" x:Name="Text" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Right" TextWrapping="NoWrap"/>
                                </inputToolkit:ButtonSpinner>
                            </Border>
                            <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/>
                            <Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <ControlTemplate x:Key="ButtonSpinnerTopTemplate" TargetType="inputToolkit:ButtonSpinner">
            <Grid>
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualStateGroup.Transitions>
                            <vsm:VisualTransition GeneratedDuration="0"/>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Normal"/>
                        <vsm:VisualState x:Name="Disabled">
                            <Storyboard>
                                <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                    <vsm:VisualStateGroup x:Name="FocusStates">
                        <vsm:VisualState x:Name="Focused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Unfocused"/>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="10"/>
                    </Grid.RowDefinitions>
                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" Grid.ColumnSpan="2"/>
                    <RepeatButton x:Name="IncreaseButton" IsTabStop="False" Template="{StaticResource IncreaseButtonTemplate}" Grid.Column="0" Grid.Row="1" ClickMode="Press"/>
                    <RepeatButton x:Name="DecreaseButton" IsTabStop="False" Template="{StaticResource DecreaseButtonTemplate}" Grid.Column="1" Grid.Row="1" ClickMode="Press"/>
                </Grid>
                <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/>
                <Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderBrush="#FF45D6FA" BorderThickness="1" CornerRadius="1,1,1,1"/>
            </Grid>
        </ControlTemplate>
        <Style x:Key="ButtonSpinnerTopStyle" TargetType="inputToolkit:NumericUpDown">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="{StaticResource NUDBorderBrush}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="inputToolkit:NumericUpDown">
                        <Grid>
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualTransition GeneratedDuration="0"/>
                                    </vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualState x:Name="Normal"/>
                                    <vsm:VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="FocusStates">
                                    <vsm:VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Unfocused"/>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                <inputToolkit:ButtonSpinner x:Name="Spinner" MinWidth="20" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Template="{StaticResource ButtonSpinnerTopTemplate}">
                                    <TextBox BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="20" x:Name="Text" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Right" TextWrapping="NoWrap"/>
                                </inputToolkit:ButtonSpinner>
                            </Border>
                            <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/>
                            <Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <StackPanel>
        <!-- Basic Scenarios -->
        <ContentControl Content="Basic Scenarios" Style="{StaticResource Header}" />
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="50" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="150" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="Default" FontWeight="Bold"/>
            <inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="0" Margin="5"/>
            <TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Description}" Text="IsEditable=false"/>
            <inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="1" Margin="5" IsEditable="False"/>
            <TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Description}" Text="DecimalPlaces=2"/>
            <inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="2" Margin="5" DecimalPlaces="2"/>
            <TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource Description}" Text="Min=1,Max=2,Inc=0.1,DPs=1"/>
            <inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="3" Margin="5" Minimum="1" Maximum="2" Increment="0.1" DecimalPlaces="1"/>
        </Grid>

        <!-- Customization -->
        <ContentControl Content="Customizations" Style="{StaticResource Header}" />
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="100" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="150" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="Horizontal Layout"/>
            <inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="0" Style="{StaticResource ButtonSpinnerHorizontalStyle}" Margin="5" Height="90" FontSize="50"/>
            <TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Description}" Text="Vertical Layout"/>
            <inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="1" Style="{StaticResource ButtonSpinnerVerticalStyle}" Margin="5" Height="90" FontSize="50"/>
            <TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Description}" Text="Top Layout"/>
            <inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="2" Style="{StaticResource ButtonSpinnerTopStyle}" Margin="5" Height="90" FontSize="50"/>
            <TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource Description}" Text="Lefty Layout"/>
            <inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="3" Style="{StaticResource ButtonSpinnerLeftyStyle}" Margin="5" Height="90" FontSize="50"/>
        </Grid>

        <!-- Interactive Usage -->
        <ContentControl Content="Interactive Usage" Style="{StaticResource Header}" />
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="10" />
                <ColumnDefinition Width="200" />
            </Grid.ColumnDefinitions>
            <Grid>
                <StackPanel>
                    <Button Content="Button1"/>
                    <inputToolkit:NumericUpDown x:Name="nud"/>
                    <Button Content="Button2"/>
                    <TextBlock x:Name="output" />
                </StackPanel>
            </Grid>
            <Grid Grid.Column="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="5" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <TextBlock Text="Minimum:" Grid.Row="0" Grid.Column="0" />
                <TextBox x:Name="tbMininum" Grid.Row="0" Grid.Column="2" Text="0"/>

                <TextBlock Text="Maximum:" Grid.Row="1" Grid.Column="0" />
                <TextBox x:Name="tbMaximum" Grid.Row="1" Grid.Column="2" Text="100"/>

                <TextBlock Text="Value:" Grid.Row="2" Grid.Column="0" />
                <TextBox x:Name="tbValue" Grid.Row="2" Grid.Column="2" Text="0"/>

                <TextBlock Text="Increment:" Grid.Row="3" Grid.Column="0" />
                <TextBox x:Name="tbIncrement" Grid.Row="3" Grid.Column="2" Text="1"/>

                <TextBlock Text="DecimalPlaces:" Grid.Row="4" Grid.Column="0" />
                <TextBox x:Name="tbDecimalPlaces" Grid.Row="4" Grid.Column="2" Text="0"/>

                <CheckBox x:Name="cbIsEditable" Grid.Row="5" Grid.Column="2" 
                          IsChecked="True"
                          HorizontalAlignment="Left" Content="IsEditable"/>

                <CheckBox x:Name="cbIsEnabled" Grid.Row="6" Grid.Column="2"
                          IsChecked="True"
                          HorizontalAlignment="Left" Content="IsEnabled" />

                <Button x:Name="btnChange" Grid.Row="7" Grid.Column="2"
                        HorizontalAlignment="Left" Content="Change!"/>
            </Grid>
        </Grid>

        <!-- Fill the space -->
        <Grid>
        </Grid>
        <src:SourceViewer xmlns:src="clr-namespace:System.Windows.Controls.Samples;assembly=System.Windows.Controls.Samples.Common" xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <src:SourceFile Path="NumericUpDownSample.xaml">
    <src:SourceFile.Source>
      <sys:String>&lt;!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
--&gt;

&lt;UserControl x:Class="System.Windows.Controls.Samples.NumericUpDownSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    
    &gt;
    &lt;UserControl.Resources&gt;
        &lt;ControlTemplate x:Key="IncreaseButtonTemplate" TargetType="RepeatButton"&gt;
            &lt;Grid x:Name="Root"&gt;
                &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                    &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                        &lt;vsm:VisualStateGroup.Transitions&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/&gt;
                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                        &lt;vsm:VisualState x:Name="Normal"/&gt;
                        &lt;vsm:VisualState x:Name="MouseOver"&gt;
                            &lt;Storyboard&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#FF448DCA"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#F2FFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#CCFFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#7FFFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                        &lt;vsm:VisualState x:Name="Pressed"&gt;
                            &lt;Storyboard&gt;
                                &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="Highlight" Storyboard.TargetProperty="(UIElement.Opacity)"&gt;
                                    &lt;SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/&gt;
                                &lt;/DoubleAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#FF448DCA"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#F4FFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#EAFFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#C6FFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#6BFFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                    &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                        &lt;vsm:VisualState x:Name="Focused"&gt;
                            &lt;Storyboard&gt;
                                &lt;ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility"&gt;
                                    &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/&gt;
                                &lt;/ObjectAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                        &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                &lt;Rectangle x:Name="Background" RadiusX="2" RadiusY="2" Fill="{TemplateBinding Background}" StrokeThickness="1"&gt;
                    &lt;Rectangle.Stroke&gt;
                        &lt;LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0"&gt;
                            &lt;GradientStop Color="#FFAEB7BF" Offset="0"/&gt;
                            &lt;GradientStop Color="#FF919EA7" Offset="0.35"/&gt;
                            &lt;GradientStop Color="#FF7A8A99" Offset="0.35"/&gt;
                            &lt;GradientStop Color="#FF647480" Offset="1"/&gt;
                        &lt;/LinearGradientBrush&gt;
                    &lt;/Rectangle.Stroke&gt;
                &lt;/Rectangle&gt;
                &lt;Rectangle Margin="1" x:Name="BackgroundGradient" RadiusX="1" RadiusY="1" Stroke="#FFFFFFFF" StrokeThickness="1"&gt;
                    &lt;Rectangle.Fill&gt;
                        &lt;LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0"&gt;
                            &lt;GradientStop Color="#FFFFFFFF" Offset="0"/&gt;
                            &lt;GradientStop Color="#F9FFFFFF" Offset="0.375"/&gt;
                            &lt;GradientStop Color="#E5FFFFFF" Offset="0.625"/&gt;
                            &lt;GradientStop Color="#C6FFFFFF" Offset="1"/&gt;
                        &lt;/LinearGradientBrush&gt;
                    &lt;/Rectangle.Fill&gt;
                &lt;/Rectangle&gt;
                &lt;Rectangle Margin="1" x:Name="Highlight" IsHitTestVisible="false" Opacity="0" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA" StrokeThickness="1"/&gt;
                &lt;Rectangle x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA" StrokeThickness="1"/&gt;
                &lt;Path HorizontalAlignment="Stretch" Margin="4,3,4,3" VerticalAlignment="Stretch" Fill="#FF333333" Stretch="Uniform" Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z "/&gt;
            &lt;/Grid&gt;
        &lt;/ControlTemplate&gt;
        &lt;ControlTemplate x:Key="DecreaseButtonTemplate" TargetType="RepeatButton"&gt;
            &lt;Grid x:Name="Root"&gt;
                &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                    &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                        &lt;vsm:VisualStateGroup.Transitions&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/&gt;
                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                        &lt;vsm:VisualState x:Name="Normal"/&gt;
                        &lt;vsm:VisualState x:Name="MouseOver"&gt;
                            &lt;Storyboard&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#FF448DCA"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#F2FFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#CCFFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#7FFFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                        &lt;vsm:VisualState x:Name="Pressed"&gt;
                            &lt;Storyboard&gt;
                                &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="Highlight" Storyboard.TargetProperty="(UIElement.Opacity)"&gt;
                                    &lt;SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/&gt;
                                &lt;/DoubleAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#FF448DCA"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#F4FFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#EAFFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#C6FFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                                &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"&gt;
                                    &lt;SplineColorKeyFrame KeyTime="00:00:00" Value="#6BFFFFFF"/&gt;
                                &lt;/ColorAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                    &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                        &lt;vsm:VisualState x:Name="Focused"&gt;
                            &lt;Storyboard&gt;
                                &lt;ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility"&gt;
                                    &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/&gt;
                                &lt;/ObjectAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                        &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                &lt;Rectangle x:Name="Background" RadiusX="2" RadiusY="2" Fill="{TemplateBinding Background}" StrokeThickness="1"&gt;
                    &lt;Rectangle.Stroke&gt;
                        &lt;LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0"&gt;
                            &lt;GradientStop Color="#FFAEB7BF" Offset="0"/&gt;
                            &lt;GradientStop Color="#FF919EA7" Offset="0.35"/&gt;
                            &lt;GradientStop Color="#FF7A8A99" Offset="0.35"/&gt;
                            &lt;GradientStop Color="#FF647480" Offset="1"/&gt;
                        &lt;/LinearGradientBrush&gt;
                    &lt;/Rectangle.Stroke&gt;
                &lt;/Rectangle&gt;
                &lt;Rectangle Margin="1" x:Name="BackgroundGradient" RadiusX="1" RadiusY="1" Stroke="#FFFFFFFF" StrokeThickness="1"&gt;
                    &lt;Rectangle.Fill&gt;
                        &lt;LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0"&gt;
                            &lt;GradientStop Color="#FFFFFFFF" Offset="0"/&gt;
                            &lt;GradientStop Color="#F9FFFFFF" Offset="0.375"/&gt;
                            &lt;GradientStop Color="#E5FFFFFF" Offset="0.625"/&gt;
                            &lt;GradientStop Color="#C6FFFFFF" Offset="1"/&gt;
                        &lt;/LinearGradientBrush&gt;
                    &lt;/Rectangle.Fill&gt;
                &lt;/Rectangle&gt;
                &lt;Rectangle Margin="1" x:Name="Highlight" IsHitTestVisible="false" Opacity="0" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA" StrokeThickness="1"/&gt;
                &lt;Rectangle x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA" StrokeThickness="1"/&gt;
                &lt;Path Height="Auto" HorizontalAlignment="Stretch" Margin="4,3,4,3" VerticalAlignment="Stretch" Width="Auto" Fill="#FF333333" Stretch="Uniform" Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z "/&gt;
            &lt;/Grid&gt;
        &lt;/ControlTemplate&gt;

        &lt;LinearGradientBrush x:Key="NUDBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0"&gt;
            &lt;GradientStop Color="#FFA3AEB9" Offset="0"/&gt;
            &lt;GradientStop Color="#FF8399A9" Offset="0.375"/&gt;
            &lt;GradientStop Color="#FF718597" Offset="0.375"/&gt;
            &lt;GradientStop Color="#FF617584" Offset="1"/&gt;
        &lt;/LinearGradientBrush&gt;

        &lt;ControlTemplate x:Key="ButtonSpinnerHorizontalTemplate" TargetType="inputToolkit:ButtonSpinner"&gt;
            &lt;Grid&gt;
                &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                    &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                        &lt;vsm:VisualStateGroup.Transitions&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                        &lt;vsm:VisualState x:Name="Normal"/&gt;
                        &lt;vsm:VisualState x:Name="Disabled"&gt;
                            &lt;Storyboard&gt;
                                &lt;DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                    &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                        &lt;vsm:VisualState x:Name="Focused"&gt;
                            &lt;Storyboard&gt;
                                &lt;ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility"&gt;
                                    &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/&gt;
                                &lt;/ObjectAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                        &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                &lt;Grid&gt;
                    &lt;Grid.ColumnDefinitions&gt;
                        &lt;ColumnDefinition Width="15"/&gt;
                        &lt;ColumnDefinition Width="*"/&gt;
                        &lt;ColumnDefinition Width="15"/&gt;
                    &lt;/Grid.ColumnDefinitions&gt;
                    &lt;ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" Grid.Column="1"/&gt;
                    &lt;RepeatButton IsTabStop="False" Template="{StaticResource IncreaseButtonTemplate}" x:Name="IncreaseButton" ClickMode="Press"/&gt;
                    &lt;RepeatButton IsTabStop="False" Template="{StaticResource DecreaseButtonTemplate}" x:Name="DecreaseButton" ClickMode="Press" Grid.Column="2"/&gt;
                &lt;/Grid&gt;
                &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/&gt;
                &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderBrush="#FF45D6FA" BorderThickness="1" CornerRadius="1,1,1,1"/&gt;
            &lt;/Grid&gt;
        &lt;/ControlTemplate&gt;
        &lt;Style x:Key="ButtonSpinnerHorizontalStyle" TargetType="inputToolkit:NumericUpDown"&gt;
            &lt;Setter Property="BorderThickness" Value="1"/&gt;
            &lt;Setter Property="BorderBrush" Value="{StaticResource NUDBorderBrush}"/&gt;
            &lt;Setter Property="Template"&gt;
                &lt;Setter.Value&gt;
                    &lt;ControlTemplate TargetType="inputToolkit:NumericUpDown"&gt;
                        &lt;Grid&gt;
                            &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                                &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                                    &lt;vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                                    &lt;/vsm:VisualStateGroup.Transitions&gt;
                                    &lt;vsm:VisualState x:Name="Normal"/&gt;
                                    &lt;vsm:VisualState x:Name="Disabled"&gt;
                                        &lt;Storyboard&gt;
                                            &lt;DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/&gt;
                                        &lt;/Storyboard&gt;
                                    &lt;/vsm:VisualState&gt;
                                &lt;/vsm:VisualStateGroup&gt;
                                &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                                    &lt;vsm:VisualState x:Name="Focused"&gt;
                                        &lt;Storyboard&gt;
                                            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity"&gt;
                                                &lt;SplineDoubleKeyFrame KeyTime="0" Value="1"/&gt;
                                            &lt;/DoubleAnimationUsingKeyFrames&gt;
                                        &lt;/Storyboard&gt;
                                    &lt;/vsm:VisualState&gt;
                                    &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                                &lt;/vsm:VisualStateGroup&gt;
                            &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                            &lt;Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"&gt;
                                &lt;inputToolkit:ButtonSpinner x:Name="Spinner" MinWidth="35" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Template="{StaticResource ButtonSpinnerHorizontalTemplate}"&gt;
                                    &lt;TextBox BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="20" x:Name="Text" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Right" TextWrapping="NoWrap"/&gt;
                                &lt;/inputToolkit:ButtonSpinner&gt;
                            &lt;/Border&gt;
                            &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/&gt;
                            &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/&gt;
                        &lt;/Grid&gt;
                    &lt;/ControlTemplate&gt;
                &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
        &lt;/Style&gt;

        &lt;ControlTemplate x:Key="ButtonSpinnerVerticalTemplate" TargetType="inputToolkit:ButtonSpinner"&gt;
            &lt;Grid&gt;
                &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                    &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                        &lt;vsm:VisualStateGroup.Transitions&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                        &lt;vsm:VisualState x:Name="Normal"/&gt;
                        &lt;vsm:VisualState x:Name="Disabled"&gt;
                            &lt;Storyboard&gt;
                                &lt;DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                    &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                        &lt;vsm:VisualState x:Name="Focused"&gt;
                            &lt;Storyboard&gt;
                                &lt;ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility"&gt;
                                    &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/&gt;
                                &lt;/ObjectAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                        &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                &lt;Grid&gt;
                    &lt;Grid.RowDefinitions&gt;
                        &lt;RowDefinition Height="10"/&gt;
                        &lt;RowDefinition Height="*"/&gt;
                        &lt;RowDefinition Height="10"/&gt;
                    &lt;/Grid.RowDefinitions&gt;
                    &lt;ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" Grid.Row="1"/&gt;
                    &lt;RepeatButton IsTabStop="False" Template="{StaticResource IncreaseButtonTemplate}" x:Name="IncreaseButton" ClickMode="Press"/&gt;
                    &lt;RepeatButton IsTabStop="False" Template="{StaticResource DecreaseButtonTemplate}" x:Name="DecreaseButton" ClickMode="Press" Grid.Row="2"/&gt;
                &lt;/Grid&gt;
                &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/&gt;
                &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderBrush="#FF45D6FA" BorderThickness="1" CornerRadius="1,1,1,1"/&gt;
            &lt;/Grid&gt;
        &lt;/ControlTemplate&gt;
        &lt;Style x:Key="ButtonSpinnerVerticalStyle" TargetType="inputToolkit:NumericUpDown"&gt;
            &lt;Setter Property="BorderThickness" Value="1"/&gt;
            &lt;Setter Property="BorderBrush" Value="{StaticResource NUDBorderBrush}"/&gt;
            &lt;Setter Property="Template"&gt;
                &lt;Setter.Value&gt;
                    &lt;ControlTemplate TargetType="inputToolkit:NumericUpDown"&gt;
                        &lt;Grid&gt;
                            &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                                &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                                    &lt;vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                                    &lt;/vsm:VisualStateGroup.Transitions&gt;
                                    &lt;vsm:VisualState x:Name="Normal"/&gt;
                                    &lt;vsm:VisualState x:Name="Disabled"&gt;
                                        &lt;Storyboard&gt;
                                            &lt;DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/&gt;
                                        &lt;/Storyboard&gt;
                                    &lt;/vsm:VisualState&gt;
                                &lt;/vsm:VisualStateGroup&gt;
                                &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                                    &lt;vsm:VisualState x:Name="Focused"&gt;
                                        &lt;Storyboard&gt;
                                            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity"&gt;
                                                &lt;SplineDoubleKeyFrame KeyTime="0" Value="1"/&gt;
                                            &lt;/DoubleAnimationUsingKeyFrames&gt;
                                        &lt;/Storyboard&gt;
                                    &lt;/vsm:VisualState&gt;
                                    &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                                &lt;/vsm:VisualStateGroup&gt;
                            &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                            &lt;Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"&gt;
                                &lt;inputToolkit:ButtonSpinner x:Name="Spinner" MinWidth="35" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Template="{StaticResource ButtonSpinnerVerticalTemplate}"&gt;
                                    &lt;TextBox BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="20" x:Name="Text" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Right" TextWrapping="NoWrap"/&gt;
                                &lt;/inputToolkit:ButtonSpinner&gt;
                            &lt;/Border&gt;
                            &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/&gt;
                            &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/&gt;
                        &lt;/Grid&gt;
                    &lt;/ControlTemplate&gt;
                &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
        &lt;/Style&gt;

        &lt;ControlTemplate x:Key="ButtonSpinnerLeftyTemplate" TargetType="inputToolkit:ButtonSpinner"&gt;
            &lt;Grid&gt;
                &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                    &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                        &lt;vsm:VisualStateGroup.Transitions&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                        &lt;vsm:VisualState x:Name="Normal"/&gt;
                        &lt;vsm:VisualState x:Name="Disabled"&gt;
                            &lt;Storyboard&gt;
                                &lt;DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                    &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                        &lt;vsm:VisualState x:Name="Focused"&gt;
                            &lt;Storyboard&gt;
                                &lt;ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility"&gt;
                                    &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/&gt;
                                &lt;/ObjectAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                        &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                &lt;Grid&gt;
                    &lt;Grid.ColumnDefinitions&gt;
                        &lt;ColumnDefinition Width="15"/&gt;
                        &lt;ColumnDefinition/&gt;
                    &lt;/Grid.ColumnDefinitions&gt;
                    &lt;Grid.RowDefinitions&gt;
                        &lt;RowDefinition/&gt;
                        &lt;RowDefinition/&gt;
                    &lt;/Grid.RowDefinitions&gt;
                    &lt;ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" Grid.Column="1" Grid.RowSpan="2"/&gt;
                    &lt;RepeatButton x:Name="IncreaseButton" IsTabStop="False" Template="{StaticResource IncreaseButtonTemplate}" Grid.Column="0" Grid.Row="0" ClickMode="Press"/&gt;
                    &lt;RepeatButton x:Name="DecreaseButton" IsTabStop="False" Template="{StaticResource DecreaseButtonTemplate}" Grid.Column="0" Grid.Row="1" ClickMode="Press"/&gt;
                &lt;/Grid&gt;
                &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/&gt;
                &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderBrush="#FF45D6FA" BorderThickness="1" CornerRadius="1,1,1,1"/&gt;
            &lt;/Grid&gt;
        &lt;/ControlTemplate&gt;
        &lt;Style x:Key="ButtonSpinnerLeftyStyle" TargetType="inputToolkit:NumericUpDown"&gt;
            &lt;Setter Property="BorderThickness" Value="1"/&gt;
            &lt;Setter Property="BorderBrush" Value="{StaticResource NUDBorderBrush}"/&gt;
            &lt;Setter Property="Template"&gt;
                &lt;Setter.Value&gt;
                    &lt;ControlTemplate TargetType="inputToolkit:NumericUpDown"&gt;
                        &lt;Grid&gt;
                            &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                                &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                                    &lt;vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                                    &lt;/vsm:VisualStateGroup.Transitions&gt;
                                    &lt;vsm:VisualState x:Name="Normal"/&gt;
                                    &lt;vsm:VisualState x:Name="Disabled"&gt;
                                        &lt;Storyboard&gt;
                                            &lt;DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/&gt;
                                        &lt;/Storyboard&gt;
                                    &lt;/vsm:VisualState&gt;
                                &lt;/vsm:VisualStateGroup&gt;
                                &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                                    &lt;vsm:VisualState x:Name="Focused"&gt;
                                        &lt;Storyboard&gt;
                                            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity"&gt;
                                                &lt;SplineDoubleKeyFrame KeyTime="0" Value="1"/&gt;
                                            &lt;/DoubleAnimationUsingKeyFrames&gt;
                                        &lt;/Storyboard&gt;
                                    &lt;/vsm:VisualState&gt;
                                    &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                                &lt;/vsm:VisualStateGroup&gt;
                            &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                            &lt;Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"&gt;
                                &lt;inputToolkit:ButtonSpinner x:Name="Spinner" MinWidth="35" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Template="{StaticResource ButtonSpinnerLeftyTemplate}"&gt;
                                    &lt;TextBox BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="20" x:Name="Text" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Right" TextWrapping="NoWrap"/&gt;
                                &lt;/inputToolkit:ButtonSpinner&gt;
                            &lt;/Border&gt;
                            &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/&gt;
                            &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/&gt;
                        &lt;/Grid&gt;
                    &lt;/ControlTemplate&gt;
                &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
        &lt;/Style&gt;

        &lt;ControlTemplate x:Key="ButtonSpinnerTopTemplate" TargetType="inputToolkit:ButtonSpinner"&gt;
            &lt;Grid&gt;
                &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                    &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                        &lt;vsm:VisualStateGroup.Transitions&gt;
                            &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                        &lt;/vsm:VisualStateGroup.Transitions&gt;
                        &lt;vsm:VisualState x:Name="Normal"/&gt;
                        &lt;vsm:VisualState x:Name="Disabled"&gt;
                            &lt;Storyboard&gt;
                                &lt;DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                    &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                        &lt;vsm:VisualState x:Name="Focused"&gt;
                            &lt;Storyboard&gt;
                                &lt;ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility"&gt;
                                    &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/&gt;
                                &lt;/ObjectAnimationUsingKeyFrames&gt;
                            &lt;/Storyboard&gt;
                        &lt;/vsm:VisualState&gt;
                        &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                    &lt;/vsm:VisualStateGroup&gt;
                &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                &lt;Grid&gt;
                    &lt;Grid.ColumnDefinitions&gt;
                        &lt;ColumnDefinition/&gt;
                        &lt;ColumnDefinition/&gt;
                    &lt;/Grid.ColumnDefinitions&gt;
                    &lt;Grid.RowDefinitions&gt;
                        &lt;RowDefinition/&gt;
                        &lt;RowDefinition Height="10"/&gt;
                    &lt;/Grid.RowDefinitions&gt;
                    &lt;ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" Grid.ColumnSpan="2"/&gt;
                    &lt;RepeatButton x:Name="IncreaseButton" IsTabStop="False" Template="{StaticResource IncreaseButtonTemplate}" Grid.Column="0" Grid.Row="1" ClickMode="Press"/&gt;
                    &lt;RepeatButton x:Name="DecreaseButton" IsTabStop="False" Template="{StaticResource DecreaseButtonTemplate}" Grid.Column="1" Grid.Row="1" ClickMode="Press"/&gt;
                &lt;/Grid&gt;
                &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/&gt;
                &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderBrush="#FF45D6FA" BorderThickness="1" CornerRadius="1,1,1,1"/&gt;
            &lt;/Grid&gt;
        &lt;/ControlTemplate&gt;
        &lt;Style x:Key="ButtonSpinnerTopStyle" TargetType="inputToolkit:NumericUpDown"&gt;
            &lt;Setter Property="BorderThickness" Value="1"/&gt;
            &lt;Setter Property="BorderBrush" Value="{StaticResource NUDBorderBrush}"/&gt;
            &lt;Setter Property="Template"&gt;
                &lt;Setter.Value&gt;
                    &lt;ControlTemplate TargetType="inputToolkit:NumericUpDown"&gt;
                        &lt;Grid&gt;
                            &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                                &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                                    &lt;vsm:VisualStateGroup.Transitions&gt;
                                        &lt;vsm:VisualTransition GeneratedDuration="0"/&gt;
                                    &lt;/vsm:VisualStateGroup.Transitions&gt;
                                    &lt;vsm:VisualState x:Name="Normal"/&gt;
                                    &lt;vsm:VisualState x:Name="Disabled"&gt;
                                        &lt;Storyboard&gt;
                                            &lt;DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/&gt;
                                        &lt;/Storyboard&gt;
                                    &lt;/vsm:VisualState&gt;
                                &lt;/vsm:VisualStateGroup&gt;
                                &lt;vsm:VisualStateGroup x:Name="FocusStates"&gt;
                                    &lt;vsm:VisualState x:Name="Focused"&gt;
                                        &lt;Storyboard&gt;
                                            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity"&gt;
                                                &lt;SplineDoubleKeyFrame KeyTime="0" Value="1"/&gt;
                                            &lt;/DoubleAnimationUsingKeyFrames&gt;
                                        &lt;/Storyboard&gt;
                                    &lt;/vsm:VisualState&gt;
                                    &lt;vsm:VisualState x:Name="Unfocused"/&gt;
                                &lt;/vsm:VisualStateGroup&gt;
                            &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                            &lt;Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"&gt;
                                &lt;inputToolkit:ButtonSpinner x:Name="Spinner" MinWidth="20" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Template="{StaticResource ButtonSpinnerTopTemplate}"&gt;
                                    &lt;TextBox BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="20" x:Name="Text" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Right" TextWrapping="NoWrap"/&gt;
                                &lt;/inputToolkit:ButtonSpinner&gt;
                            &lt;/Border&gt;
                            &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/&gt;
                            &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/&gt;
                        &lt;/Grid&gt;
                    &lt;/ControlTemplate&gt;
                &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
        &lt;/Style&gt;
    &lt;/UserControl.Resources&gt;

    &lt;StackPanel&gt;
        &lt;!-- Basic Scenarios --&gt;
        &lt;ContentControl Content="Basic Scenarios" Style="{StaticResource Header}" /&gt;
        &lt;Grid&gt;
            &lt;Grid.RowDefinitions&gt;
                &lt;RowDefinition Height="Auto" /&gt;
                &lt;RowDefinition Height="50" /&gt;
            &lt;/Grid.RowDefinitions&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition Width="150" /&gt;
                &lt;ColumnDefinition Width="150" /&gt;
                &lt;ColumnDefinition Width="150" /&gt;
                &lt;ColumnDefinition Width="150" /&gt;
            &lt;/Grid.ColumnDefinitions&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="Default" FontWeight="Bold"/&gt;
            &lt;inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="0" Margin="5"/&gt;
            &lt;TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Description}" Text="IsEditable=false"/&gt;
            &lt;inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="1" Margin="5" IsEditable="False"/&gt;
            &lt;TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Description}" Text="DecimalPlaces=2"/&gt;
            &lt;inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="2" Margin="5" DecimalPlaces="2"/&gt;
            &lt;TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource Description}" Text="Min=1,Max=2,Inc=0.1,DPs=1"/&gt;
            &lt;inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="3" Margin="5" Minimum="1" Maximum="2" Increment="0.1" DecimalPlaces="1"/&gt;
        &lt;/Grid&gt;

        &lt;!-- Customization --&gt;
        &lt;ContentControl Content="Customizations" Style="{StaticResource Header}" /&gt;
        &lt;Grid&gt;
            &lt;Grid.RowDefinitions&gt;
                &lt;RowDefinition Height="Auto" /&gt;
                &lt;RowDefinition Height="100" /&gt;
            &lt;/Grid.RowDefinitions&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition Width="150" /&gt;
                &lt;ColumnDefinition Width="150" /&gt;
                &lt;ColumnDefinition Width="150" /&gt;
                &lt;ColumnDefinition Width="150" /&gt;
            &lt;/Grid.ColumnDefinitions&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="Horizontal Layout"/&gt;
            &lt;inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="0" Style="{StaticResource ButtonSpinnerHorizontalStyle}" Margin="5" Height="90" FontSize="50"/&gt;
            &lt;TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Description}" Text="Vertical Layout"/&gt;
            &lt;inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="1" Style="{StaticResource ButtonSpinnerVerticalStyle}" Margin="5" Height="90" FontSize="50"/&gt;
            &lt;TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Description}" Text="Top Layout"/&gt;
            &lt;inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="2" Style="{StaticResource ButtonSpinnerTopStyle}" Margin="5" Height="90" FontSize="50"/&gt;
            &lt;TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource Description}" Text="Lefty Layout"/&gt;
            &lt;inputToolkit:NumericUpDown Grid.Row="1" Grid.Column="3" Style="{StaticResource ButtonSpinnerLeftyStyle}" Margin="5" Height="90" FontSize="50"/&gt;
        &lt;/Grid&gt;

        &lt;!-- Interactive Usage --&gt;
        &lt;ContentControl Content="Interactive Usage" Style="{StaticResource Header}" /&gt;
        &lt;Grid&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="10" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
            &lt;/Grid.ColumnDefinitions&gt;
            &lt;Grid&gt;
                &lt;StackPanel&gt;
                    &lt;Button Content="Button1"/&gt;
                    &lt;inputToolkit:NumericUpDown x:Name="nud"/&gt;
                    &lt;Button Content="Button2"/&gt;
                    &lt;TextBlock x:Name="output" /&gt;
                &lt;/StackPanel&gt;
            &lt;/Grid&gt;
            &lt;Grid Grid.Column="2"&gt;
                &lt;Grid.ColumnDefinitions&gt;
                    &lt;ColumnDefinition Width="100" /&gt;
                    &lt;ColumnDefinition Width="5" /&gt;
                    &lt;ColumnDefinition Width="*" /&gt;
                &lt;/Grid.ColumnDefinitions&gt;
                &lt;Grid.RowDefinitions&gt;
                    &lt;RowDefinition Height="Auto" /&gt;
                    &lt;RowDefinition Height="Auto" /&gt;
                    &lt;RowDefinition Height="Auto" /&gt;
                    &lt;RowDefinition Height="Auto" /&gt;
                    &lt;RowDefinition Height="Auto" /&gt;
                    &lt;RowDefinition Height="Auto" /&gt;
                    &lt;RowDefinition Height="Auto" /&gt;
                    &lt;RowDefinition Height="Auto" /&gt;
                &lt;/Grid.RowDefinitions&gt;

                &lt;TextBlock Text="Minimum:" Grid.Row="0" Grid.Column="0" /&gt;
                &lt;TextBox x:Name="tbMininum" Grid.Row="0" Grid.Column="2" Text="0"/&gt;

                &lt;TextBlock Text="Maximum:" Grid.Row="1" Grid.Column="0" /&gt;
                &lt;TextBox x:Name="tbMaximum" Grid.Row="1" Grid.Column="2" Text="100"/&gt;

                &lt;TextBlock Text="Value:" Grid.Row="2" Grid.Column="0" /&gt;
                &lt;TextBox x:Name="tbValue" Grid.Row="2" Grid.Column="2" Text="0"/&gt;

                &lt;TextBlock Text="Increment:" Grid.Row="3" Grid.Column="0" /&gt;
                &lt;TextBox x:Name="tbIncrement" Grid.Row="3" Grid.Column="2" Text="1"/&gt;

                &lt;TextBlock Text="DecimalPlaces:" Grid.Row="4" Grid.Column="0" /&gt;
                &lt;TextBox x:Name="tbDecimalPlaces" Grid.Row="4" Grid.Column="2" Text="0"/&gt;

                &lt;CheckBox x:Name="cbIsEditable" Grid.Row="5" Grid.Column="2" 
                          IsChecked="True"
                          HorizontalAlignment="Left" Content="IsEditable"/&gt;

                &lt;CheckBox x:Name="cbIsEnabled" Grid.Row="6" Grid.Column="2"
                          IsChecked="True"
                          HorizontalAlignment="Left" Content="IsEnabled" /&gt;

                &lt;Button x:Name="btnChange" Grid.Row="7" Grid.Column="2"
                        HorizontalAlignment="Left" Content="Change!"/&gt;
            &lt;/Grid&gt;
        &lt;/Grid&gt;

        &lt;!-- Fill the space --&gt;
        &lt;Grid&gt;
        &lt;/Grid&gt;
    &lt;/StackPanel&gt;
&lt;/UserControl&gt;</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="NumericUpDownSample.xaml.cs">
    <src:SourceFile.Source>
      <sys:String>// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.ComponentModel;

namespace System.Windows.Controls.Samples
{
    /// &lt;summary&gt;
    /// NumericUpDown sample page.
    /// &lt;/summary&gt;
    [Sample("NumericUpDown", DifficultyLevel.Basic)]
    [Category("NumericUpDown")]
    public partial class NumericUpDownSample : UserControl
    {
        /// &lt;summary&gt;
        /// Initializes a new instance of the NumericUpDownSample class.
        /// &lt;/summary&gt;
        public NumericUpDownSample()
        {
            InitializeComponent();
            Loaded += OnLoaded;
            nud.ValueChanged += (s, e) =&gt; { OutputNUD(); };
        }

        /// &lt;summary&gt;
        /// Load the demo page.
        /// &lt;/summary&gt;
        /// &lt;param name="sender"&gt;Sample page.&lt;/param&gt;
        /// &lt;param name="e"&gt;Event arguments.&lt;/param&gt;
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            btnChange.Click += ChangeSettings;
        }

        /// &lt;summary&gt;
        /// Change ContentControl settings (Header, HeaderTemplate, Content, ContentTemplate).
        /// &lt;/summary&gt;
        /// &lt;param name="sender"&gt;Sender Button.&lt;/param&gt;
        /// &lt;param name="e"&gt;Event args.&lt;/param&gt;
        private void ChangeSettings(object sender, RoutedEventArgs e)
        {
            nud.Minimum = ParseUtility.ReadValue(tbMininum, nud.Minimum);
            nud.Maximum = ParseUtility.ReadValue(tbMaximum, nud.Maximum);
            nud.Value = ParseUtility.ReadValue(tbValue, nud.Value);
            nud.Increment = ParseUtility.ReadValue(tbIncrement, nud.Increment);
            nud.DecimalPlaces = ParseUtility.ReadValue(tbDecimalPlaces, nud.DecimalPlaces);
            nud.IsEditable = cbIsEditable.IsChecked ?? false;
            nud.IsEnabled = cbIsEnabled.IsChecked ?? true;

            OutputNUD();
        }

        /// &lt;summary&gt;
        /// Display the interactive NumericUpDown control's properties.
        /// &lt;/summary&gt;
        private void OutputNUD()
        {
            string formatString = "\n\n" +
                " Minimum:\t{0}\n Maximum:\t{1}\n Value:\t{2}\n" + 
                " Increment:\t{3}\n DecimalPlaces:\t{4}\n" +
                " IsEditable:\t{5}\n IsEnabled:\t{6}\n";
            output.Text = string.Format(
                CultureInfo.InvariantCulture, 
                formatString, 
                nud.Minimum, 
                nud.Maximum, 
                nud.Value, 
                nud.Increment, 
                nud.DecimalPlaces, 
                nud.IsEditable, 
                nud.IsEnabled);
        }
    }
}
</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="NumericUpDownSample.xaml.vb">
    <src:SourceFile.Source>
      <sys:String>' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.

Imports Microsoft.VisualBasic
Imports System
Imports System.Globalization
Imports System.Windows
Imports System.Windows.Controls
Imports System.ComponentModel

''' &lt;summary&gt;
''' NumericUpDown sample page.
''' &lt;/summary&gt;
&lt;Sample("NumericUpDown", DifficultyLevel.Basic), Category("NumericUpDown")&gt; _
Partial Public Class NumericUpDownSample
    Inherits UserControl
    ''' &lt;summary&gt;
    ''' Initializes a new instance of the NumericUpDownSample class.
    ''' &lt;/summary&gt;
    Public Sub New()
        InitializeComponent()
    End Sub

    ''' &lt;summary&gt;
    ''' Handle the NumericUpDown ValueChanged event
    ''' &lt;/summary&gt;
    ''' &lt;param name="sender"&gt;NumericUpDown.&lt;/param&gt;
    ''' &lt;param name="e"&gt;Event arguments.&lt;/param&gt;
    Private Sub Nud_ValueChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Double)) Handles nud.ValueChanged
        OutputNUD()
    End Sub

    ''' &lt;summary&gt;
    ''' Load the demo page.
    ''' &lt;/summary&gt;
    ''' &lt;param name="sender"&gt;Sample page.&lt;/param&gt;
    ''' &lt;param name="e"&gt;Event arguments.&lt;/param&gt;
    Private Sub OnLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles Me.Loaded
        AddHandler btnChange.Click, AddressOf ChangeSettings
    End Sub

    ''' &lt;summary&gt;
    ''' Change ContentControl settings (Header, HeaderTemplate, Content, ContentTemplate).
    ''' &lt;/summary&gt;
    ''' &lt;param name="sender"&gt;Sender Button.&lt;/param&gt;
    ''' &lt;param name="e"&gt;Event args.&lt;/param&gt;
    Private Sub ChangeSettings(ByVal sender As Object, ByVal e As RoutedEventArgs)
        nud.Minimum = ParseUtility.ReadValue(tbMininum, nud.Minimum)
        nud.Maximum = ParseUtility.ReadValue(tbMaximum, nud.Maximum)
        nud.Value = ParseUtility.ReadValue(tbValue, nud.Value)
        nud.Increment = ParseUtility.ReadValue(tbIncrement, nud.Increment)
        nud.DecimalPlaces = ParseUtility.ReadValue(tbDecimalPlaces, nud.DecimalPlaces)
        nud.IsEditable = If(cbIsEditable.IsChecked, False)
        nud.IsEnabled = If(cbIsEnabled.IsChecked, True)

        OutputNUD()
    End Sub

    ''' &lt;summary&gt;
    ''' Display the interactive NumericUpDown control's properties.
    ''' &lt;/summary&gt;
    Private Sub OutputNUD()
        Dim formatString As String = Constants.vbLf + Constants.vbLf &amp; _
        " Minimum:" &amp; _
        Constants.vbTab &amp; "{0}" &amp; Constants.vbLf &amp; " Maximum:" &amp; _
        Constants.vbTab &amp; "{1}" &amp; Constants.vbLf &amp; " Value:" &amp; _
        Constants.vbTab &amp; "{2}" &amp; Constants.vbLf &amp; " Increment:" &amp; _
        Constants.vbTab &amp; "{3}" &amp; Constants.vbLf &amp; " DecimalPlaces:" &amp; _
        Constants.vbTab &amp; "{4}" &amp; Constants.vbLf &amp; " IsEditable:" &amp; _
        Constants.vbTab &amp; "{5}" &amp; Constants.vbLf &amp; " IsEnabled:" &amp; _
        Constants.vbTab &amp; "{6}" &amp; Constants.vbLf
        output.Text = String.Format(CultureInfo.InvariantCulture, _
                                    formatString, _
                                    nud.Minimum, _
                                    nud.Maximum, _
                                    nud.Value, _
                                    nud.Increment, _
                                    nud.DecimalPlaces, _
                                    nud.IsEditable, _
                                    nud.IsEnabled)
    End Sub
End Class
</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
</src:SourceViewer>
    </StackPanel>
</UserControl>